<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>职位详情 - HRM系统</title>
    <link rel="stylesheet" th:href="@{/css/style.css}">
    <link rel="stylesheet" th:href="@{/css/position-view.css}">
</head>
<body>
<div class="dashboard">
    <header class="header">
        <div class="logo">HRM系统</div>
        <div class="user-info">
            <span th:text="${currentUser.realName}"></span>
            <span class="role-badge" th:text="${currentUser.roleId.roleName}"></span>
            <a href="/logout" class="logout-btn">退出</a>
        </div>
    </header>
    <main class="position-view-container">
        <!-- 返回按钮 -->
        <div class="back-container">
            <a th:href="@{/position}" class="btn btn-back">← 返回职位列表</a>
            <a th:href="@{/home}" class="btn btn-back">← 返回首页</a>
        </div>

        <!-- 页面标题 -->
        <div class="module-header">
            <h1 class="module-title">职位详细信息</h1>
            <div class="action-buttons" th:if="${roleIdValue lt 4}">
                <a th:href="@{/position/edit/{id}(id=${position.positionId})}" class="btn btn-primary">编辑信息</a>
            </div>
        </div>

        <!-- 职位基本信息卡片 -->
        <div class="position-card">
            <!-- 基本信息区 -->
            <div class="info-section">
                <h2 class="section-title">基本信息</h2>
                <div class="info-grid">
                    <div class="info-item">
                        <span class="info-label">职位ID：</span>
                        <span class="info-value" th:text="${position.positionId}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">职位名称：</span>
                        <span class="info-value" th:text="${position.positionName}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">职位编码：</span>
                        <span class="info-value" th:text="${position.positionCode}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">所属部门：</span>
                        <span class="info-value" th:text="${position.departmentID.departmentName}"></span>
                    </div>
                </div>
            </div>

            <!-- 权限信息区 -->
            <div class="info-section">
                <h2 class="section-title">权限信息</h2>
                <div class="info-grid">
                    <div class="info-item">
                        <span class="info-label">关联角色：</span>
                        <span class="info-value" th:text="${position.positionRoleID.roleName}"></span>
                    </div>
                </div>
            </div>

            <!-- 薪资福利区 -->
            <div class="info-section">
                <h2 class="section-title">薪资福利</h2>
                <div class="info-grid">
                    <div class="info-item">
                        <span class="info-label">基本薪资：</span>
                        <span class="info-value" th:text="${position.baseSalary}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">岗位津贴：</span>
                        <span class="info-value" th:text="${position.allowance}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">年假天数：</span>
                        <span class="info-value" th:text="${position.annualLeaveDays}"></span>
                    </div>
                </div>
            </div>

            <!-- 其他信息区 -->
            <div class="info-section">
                <h2 class="section-title">其他信息</h2>
                <div class="info-grid">
                    <div class="info-item">
                        <span class="info-label">最大编制：</span>
                        <span class="info-value" th:text="${position.maxHeadCount}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">创建时间：</span>
                        <span class="info-value" th:text="${#temporals.format(position.createTime, 'yyyy-MM-dd HH:mm')}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">更新时间：</span>
                        <span class="info-value" th:text="${position.updateTime != null ? #temporals.format(position.updateTime, 'yyyy-MM-dd HH:mm') : '--'}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">状态：</span>
                        <span class="status-active" th:if="${position.status}">启用</span>
                        <span class="status-inactive" th:unless="${position.status}">禁用</span>
                    </div>
                </div>
            </div>
        </div>
    </main>
</div>
</body>
</html>